home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / Clueless.swf / scripts / Forms / DressupResultForm.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  44.0 KB  |  1,307 lines

  1. package Forms
  2. {
  3.    import Common.SoundManager;
  4.    import caurina.transitions.Tweener;
  5.    import flash.display.*;
  6.    import flash.events.*;
  7.    import flash.geom.*;
  8.    import flash.media.SoundChannel;
  9.    import flash.system.*;
  10.    import flash.text.*;
  11.    import flash.utils.Timer;
  12.    import org.flintparticles.actions.*;
  13.    import org.flintparticles.counters.*;
  14.    import org.flintparticles.emitters.Emitter;
  15.    import org.flintparticles.initializers.*;
  16.    import org.flintparticles.renderers.*;
  17.    import org.flintparticles.zones.*;
  18.    
  19.    [Embed(source="/_assets/assets.swf", symbol="Forms.DressupResultForm")]
  20.    public class DressupResultForm extends CluelessBaseForm
  21.    {
  22.       
  23.       public static const TIMER_HIGH_RATIO:Number = 0.75;
  24.       
  25.       public static const PARTNER_CUTSCENE_2:int = 20;
  26.       
  27.       public static const BOYFRIEND_ATTRIBUTE_BONUS:Number = 0;
  28.       
  29.       public static const TIMER_MID_BONUS:Number = 100;
  30.       
  31.       public static const PART_SHOE_GOOD_MINIMUM_SCORE:Number = 100;
  32.       
  33.       public static const PART_GOOD_MINIMUM_SCORE:Number = 300;
  34.       
  35.       public static const PARTNER_CUTSCENE_1:int = 10;
  36.       
  37.       public static const MIN_LIKE_COUNT:int = 3;
  38.       
  39.       public static const PARTNER_CHAT_INTERVAL:int = 1;
  40.       
  41.       public static const PARTNER_BONUS:Number = 200;
  42.       
  43.       public static const TIMER_MID_RATIO:Number = 0.5;
  44.       
  45.       public static const TIMER_HIGH_BONUS:Number = 200;
  46.        
  47.       
  48.       internal var _nDisplayedScore:Number;
  49.       
  50.       public var _mcInsertion:MovieClip;
  51.       
  52.       internal var _nFinalScore:Number;
  53.       
  54.       public var _bDoubleDamage:PowerupDoubleDamage;
  55.       
  56.       internal var _bCherVOFashionRule:Boolean = false;
  57.       
  58.       internal var _iEffectDelay:int = 0;
  59.       
  60.       internal var _nFinalScoreMultiplier:Number = 1;
  61.       
  62.       internal var _bCherVONegative:Boolean = false;
  63.       
  64.       internal var _emitter:Emitter;
  65.       
  66.       public var _mcThumbnail:MCThumbnail;
  67.       
  68.       public var _mcPartnerLayer:MovieClip;
  69.       
  70.       public var _tfPlusMatch:TextField;
  71.       
  72.       public var _tfPlusBottom:TextField;
  73.       
  74.       public var _mcAffinityBar:TimerBarSmall;
  75.       
  76.       internal var _timer:Timer;
  77.       
  78.       public var _tfPartnerChat:TextField;
  79.       
  80.       public var _mcAccessory:DressupResultPart;
  81.       
  82.       public var _tfRanOutOfTime:TextField;
  83.       
  84.       public var _tfCherChat:TextField;
  85.       
  86.       public var _mcModelBackground:MovieClip;
  87.       
  88.       public var _tfLetter:TextField;
  89.       
  90.       internal const TIMER_INTERVAL:int = 200;
  91.       
  92.       public var _mcPlusPose:MovieClip;
  93.       
  94.       public var _cher:MovieClip;
  95.       
  96.       public var _mcBottom:DressupResultPart;
  97.       
  98.       public var _mcShoe:DressupResultPart;
  99.       
  100.       public var _mcPartnerChat:MovieClip;
  101.       
  102.       public var _mcTop:DressupResultPart;
  103.       
  104.       internal var _bPartnerVO:Boolean = false;
  105.       
  106.       public var _mcPowerupslot:MovieClip;
  107.       
  108.       public var _tfPlusTop:TextField;
  109.       
  110.       internal var _aScoreEffects:Array;
  111.       
  112.       internal var _dressupmodel:DressupModel;
  113.       
  114.       internal var _powerup:Powerup;
  115.       
  116.       public var _tfPowerupName:TextField;
  117.       
  118.       public var _mcHeart0:Heart;
  119.       
  120.       public var _mcBackground:MovieClip;
  121.       
  122.       public var _mcHeart2:Heart;
  123.       
  124.       internal var _nFinalGrade:Number;
  125.       
  126.       public var _tfModelName:TextField;
  127.       
  128.       public var _tfPoints:TextField;
  129.       
  130.       public var _mcHeart1:Heart;
  131.       
  132.       public var _tfTitle1:TextField;
  133.       
  134.       internal var nCount:int = 0;
  135.       
  136.       public var _bBack:ButtonRound;
  137.       
  138.       public var _mcDressupResultPartOk:MovieClip;
  139.       
  140.       internal var _nOriginalX:Number;
  141.       
  142.       internal var _nOriginalY:Number;
  143.       
  144.       public var _tfPlusPose:TextField;
  145.       
  146.       public var _mcCherChat:MovieClip;
  147.       
  148.       public var _rankdiamonds:MovieClip;
  149.       
  150.       public var _tfBack:TextField;
  151.       
  152.       internal var _aVoiceOvers:Array;
  153.       
  154.       public var _tfPlusTimer:TextField;
  155.       
  156.       public var _tfPerfectBonus:TextField;
  157.       
  158.       internal var _iScoringSpeed:int = 3;
  159.       
  160.       public var _tfAverage:TextField;
  161.       
  162.       public var _tfPlusShoe:TextField;
  163.       
  164.       internal var _dressuplevelinfo:DressupLevelInfo;
  165.       
  166.       internal var bTutorialCher:Boolean;
  167.       
  168.       internal var _nTimeFactor:Number = 1;
  169.       
  170.       internal var _dressuptheme:DressupTheme;
  171.       
  172.       internal var _nDisplayedScoreMultiplier:Number = 1;
  173.       
  174.       public var _tfPowerupText:TextField;
  175.       
  176.       public var _tfPlusRule:TextField;
  177.       
  178.       internal var _bCherVOPositive:Boolean = false;
  179.       
  180.       internal var bTutorial:Boolean;
  181.       
  182.       public var _mcPowerupBack:MovieClip;
  183.       
  184.       public var _mcModel:Model;
  185.       
  186.       public var _tfPlusPartner:TextField;
  187.       
  188.       public function DressupResultForm()
  189.       {
  190.          _iEffectDelay = 0;
  191.          _nFinalScoreMultiplier = 1;
  192.          _nDisplayedScoreMultiplier = 1;
  193.          nCount = 0;
  194.          _bCherVOPositive = false;
  195.          _bCherVONegative = false;
  196.          _bCherVOFashionRule = false;
  197.          _bPartnerVO = false;
  198.          _iScoringSpeed = 3;
  199.          _nTimeFactor = 1;
  200.          _aVoiceOvers = new Array();
  201.          _emitter = new Emitter();
  202.          super();
  203.       }
  204.       
  205.       public static function getLetterGrade(param1:Number) : String
  206.       {
  207.          if(param1 > 96)
  208.          {
  209.             return "A+";
  210.          }
  211.          if(param1 > 92)
  212.          {
  213.             return "A";
  214.          }
  215.          if(param1 > 89)
  216.          {
  217.             return "A-";
  218.          }
  219.          if(param1 > 86)
  220.          {
  221.             return "B+";
  222.          }
  223.          if(param1 > 82)
  224.          {
  225.             return "B";
  226.          }
  227.          if(param1 > 79)
  228.          {
  229.             return "B-";
  230.          }
  231.          if(param1 > 76)
  232.          {
  233.             return "C+";
  234.          }
  235.          if(param1 > 72)
  236.          {
  237.             return "C";
  238.          }
  239.          if(param1 > 69)
  240.          {
  241.             return "C-";
  242.          }
  243.          if(param1 > 66)
  244.          {
  245.             return "D+";
  246.          }
  247.          if(param1 > 62)
  248.          {
  249.             return "D";
  250.          }
  251.          if(param1 > 59)
  252.          {
  253.             return "D-";
  254.          }
  255.          return "F";
  256.       }
  257.       
  258.       public static function getLetterScore(param1:String) : Number
  259.       {
  260.          var _loc2_:Number = NaN;
  261.          _loc2_ = 0;
  262.          switch(param1)
  263.          {
  264.             case "A+":
  265.                _loc2_ = 100;
  266.                break;
  267.             case "A":
  268.                _loc2_ = 96;
  269.                break;
  270.             case "A-":
  271.                _loc2_ = 92;
  272.                break;
  273.             case "B+":
  274.                _loc2_ = 89;
  275.                break;
  276.             case "B":
  277.                _loc2_ = 86;
  278.                break;
  279.             case "B-":
  280.                _loc2_ = 82;
  281.                break;
  282.             case "C+":
  283.                _loc2_ = 79;
  284.                break;
  285.             case "C":
  286.                _loc2_ = 76;
  287.                break;
  288.             case "C-":
  289.                _loc2_ = 72;
  290.                break;
  291.             case "D+":
  292.                _loc2_ = 69;
  293.                break;
  294.             case "D":
  295.                _loc2_ = 66;
  296.                break;
  297.             case "D-":
  298.                _loc2_ = 62;
  299.                break;
  300.             case "F":
  301.                _loc2_ = 59;
  302.                break;
  303.             default:
  304.                _loc2_ = 0;
  305.          }
  306.          return _loc2_;
  307.       }
  308.       
  309.       protected function ConvertPartScore(param1:int) : int
  310.       {
  311.          if(param1 > 499)
  312.          {
  313.             return 95;
  314.          }
  315.          if(param1 > 299)
  316.          {
  317.             return 85;
  318.          }
  319.          if(param1 > 199)
  320.          {
  321.             return 75;
  322.          }
  323.          if(param1 > 99)
  324.          {
  325.             return 65;
  326.          }
  327.          return 55;
  328.       }
  329.       
  330.       protected function onScoreEffectClicked(param1:Event) : void
  331.       {
  332.          var _loc2_:Part = null;
  333.          _loc2_ = (param1.currentTarget as ScoreEffect)._debug as Part;
  334.          trace("Score was given for " + _loc2_.Template.Category);
  335.       }
  336.       
  337.       protected function hideExtras() : void
  338.       {
  339.          _tfRanOutOfTime.visible = false;
  340.          _bBack.visible = false;
  341.          _tfBack.visible = false;
  342.          _tfBack.mouseEnabled = false;
  343.          _tfPlusTop.visible = false;
  344.          _tfPlusBottom.visible = false;
  345.          _tfPlusShoe.visible = false;
  346.          _tfPlusPartner.visible = false;
  347.          _mcPartnerLayer.visible = false;
  348.          _mcPartnerChat.visible = false;
  349.          _tfPartnerChat.visible = false;
  350.          _mcHeart0.visible = false;
  351.          _mcHeart1.visible = false;
  352.          _mcHeart2.visible = false;
  353.          _tfPlusTimer.visible = false;
  354.          _tfPlusMatch.visible = false;
  355.          _tfPlusPose.visible = false;
  356.          _mcPlusPose.visible = false;
  357.          _tfPlusRule.visible = false;
  358.          _tfCherChat.visible = false;
  359.          _mcCherChat.visible = false;
  360.          _cher.visible = false;
  361.          _tfPerfectBonus.visible = false;
  362.          _bDoubleDamage.visible = false;
  363.       }
  364.       
  365.       protected function showCher() : void
  366.       {
  367.          _tfPlusRule.visible = true;
  368.          _tfCherChat.visible = true;
  369.          _mcCherChat.visible = true;
  370.          _cher.visible = true;
  371.          if((Profile.CurrentProfile.TutorialMask & Profile.kTutorial_FashionStyle) == 0)
  372.          {
  373.             bTutorialCher = true;
  374.             setTutorial(new MCTutorialFashionPopup());
  375.             Profile.CurrentProfile.TutorialMask |= Profile.kTutorial_FashionStyle;
  376.          }
  377.       }
  378.       
  379.       protected function tweenBonus(param1:DisplayObject) : void
  380.       {
  381.          param1.visible = true;
  382.          Tweener.addTween(param1,{
  383.             "alpha":0,
  384.             "time":8 * _nTimeFactor
  385.          });
  386.          Tweener.addTween(param1,{
  387.             "y":param1.y - 200,
  388.             "time":8 * _nTimeFactor
  389.          });
  390.       }
  391.       
  392.       protected function onTimer(param1:Event) : void
  393.       {
  394.          var _loc2_:Object = null;
  395.          var _loc3_:ScoreEffect = null;
  396.          var _loc4_:Function = null;
  397.          var _loc5_:Object = null;
  398.          if(_iEffectDelay > 0)
  399.          {
  400.             --_iEffectDelay;
  401.          }
  402.          else if(_aScoreEffects.length > 0)
  403.          {
  404.             _loc2_ = _aScoreEffects.pop();
  405.             if(_loc2_ is ScoreEffect)
  406.             {
  407.                _loc3_ = _loc2_ as ScoreEffect;
  408.                addChildAt(_loc3_,getChildIndex(_mcInsertion));
  409.                _nDisplayedScore += _loc3_.start();
  410.             }
  411.             else if(_loc2_ is Function)
  412.             {
  413.                if((_loc5_ = (_loc4_ = _loc2_ as Function)()) is String)
  414.                {
  415.                   _nDisplayedScoreMultiplier += parseFloat(_loc5_ as String);
  416.                   SoundManager.getInstance().playSound("ScoreFactorRevealedSound");
  417.                }
  418.                else
  419.                {
  420.                   _nDisplayedScore += _loc5_ as Number;
  421.                }
  422.             }
  423.             updateScore(_nDisplayedScore * _nDisplayedScoreMultiplier);
  424.          }
  425.          else
  426.          {
  427.             if(_nFinalScore < _nDisplayedScore)
  428.             {
  429.                throw "ERROR: Missing Final Score component " + _nFinalScore + " " + _nDisplayedScore;
  430.             }
  431.             if(_nFinalScore > _nDisplayedScore)
  432.             {
  433.                throw "ERROR: Missing Displayed Score component" + _nFinalScore + " " + _nDisplayedScore;
  434.             }
  435.             if(_nFinalScore * _nFinalScoreMultiplier >= 5000 && Profile.CurrentProfile.CuttingEdge == 0)
  436.             {
  437.                Profile.CurrentProfile.CuttingEdge = 1;
  438.                AchievementsList.showAchievement("cutting edge");
  439.                Storage.getInstance().saveProfiles();
  440.             }
  441.             _bBack.visible = true;
  442.             _tfBack.visible = true;
  443.             _tfBack.mouseEnabled = false;
  444.             if((Profile.CurrentProfile.TutorialMask & Profile.kTutorial_DressupMask) == 0)
  445.             {
  446.                if(_mcTutorial == null)
  447.                {
  448.                   setTutorial(new MCTutorialDressupResult());
  449.                   addSkipButton().addEventListener(MouseEvent.CLICK,onSkipTutorial,false,0,true);
  450.                }
  451.             }
  452.             _timer.removeEventListener(TimerEvent.TIMER,onTimer,false);
  453.             _timer.stop();
  454.          }
  455.       }
  456.       
  457.       protected function onAttributeScoresDone() : void
  458.       {
  459.          var _loc1_:DressupResultPart = null;
  460.          var _loc2_:int = 0;
  461.          var _loc3_:String = null;
  462.          var _loc4_:SoundChannel = null;
  463.          for each(_loc1_ in [_mcTop,_mcBottom,_mcShoe,_mcAccessory])
  464.          {
  465.             _loc1_.onFinishedScoreEffect();
  466.          }
  467.          _nFinalGrade = Math.ceil(_nFinalGrade / 3);
  468.          _tfLetter.text = getLetterGrade(_nFinalGrade);
  469.          _dressuplevelinfo.CurrentTotalLetterGrade += _nFinalGrade;
  470.          _loc2_ = _dressuplevelinfo.TotalFigures - _dressuplevelinfo.FiguresLeft;
  471.          if(_loc2_ > 0)
  472.          {
  473.             _tfAverage.text = getLetterGrade(_dressuplevelinfo.CurrentTotalLetterGrade / _loc2_);
  474.          }
  475.          if(MainDocument.VOICE_OVERS_ENABLED)
  476.          {
  477.             if(_tfLetter.text == "A" || _tfLetter.text == "A+")
  478.             {
  479.                if(!_bPartnerVO)
  480.                {
  481.                   _bCherVOPositive = true;
  482.                   _loc3_ = "positive_" + int(Math.random() * 20 + 1);
  483.                   _loc4_ = SoundManager.getInstance().playSound(_loc3_);
  484.                   _aVoiceOvers.push(_loc4_);
  485.                }
  486.             }
  487.             else if(_bCherVONegative)
  488.             {
  489.                _loc3_ = "negative_" + int(Math.random() * 14 + 1);
  490.                _loc4_ = SoundManager.getInstance().playSound(_loc3_);
  491.                _aVoiceOvers.push(_loc4_);
  492.             }
  493.          }
  494.       }
  495.       
  496.       protected function showPowerup(param1:Powerup) : void
  497.       {
  498.          if(param1 != null)
  499.          {
  500.             _tfPowerupText.visible = true;
  501.             _tfPowerupName.visible = true;
  502.             _mcPowerupslot.visible = true;
  503.             _mcPowerupBack.visible = true;
  504.             _mcPowerupslot.addChild(param1);
  505.             _tfPowerupName.text = param1.PowerupName;
  506.             param1.scaleX = 20;
  507.             param1.scaleY = 20;
  508.             param1.alpha = 0;
  509.             if(!(param1.PowerupName == "double" && _dressuplevelinfo.getLevelPartners().length > 0))
  510.             {
  511.                Tweener.addTween(param1,{
  512.                   "alpha":1,
  513.                   "time":0.25 * _nTimeFactor
  514.                });
  515.             }
  516.             Tweener.addTween(param1,{
  517.                "scaleX":2,
  518.                "scaleY":2,
  519.                "x":param1.x + 20,
  520.                "y":param1.y + 20,
  521.                "time":0.5 * _nTimeFactor
  522.             });
  523.             param1.mouseEnabled = false;
  524.             SoundManager.getInstance().playSound("NewPowerupRevealedSound");
  525.          }
  526.          else
  527.          {
  528.             _tfPowerupText.visible = false;
  529.             _tfPowerupName.visible = false;
  530.             _mcPowerupslot.visible = false;
  531.             _mcPowerupBack.visible = false;
  532.          }
  533.       }
  534.       
  535.       protected function getPartWithAttribute(param1:String) : Part
  536.       {
  537.          var _loc2_:String = null;
  538.          var _loc3_:Part = null;
  539.          for each(_loc2_ in ["top","bottom","shoe","accessory","dress","body"])
  540.          {
  541.             _loc3_ = _mcModel.getPart(_loc2_);
  542.             if(_loc3_ != null)
  543.             {
  544.                if(_loc3_.Template.hasAttribute(param1))
  545.                {
  546.                   return _loc3_;
  547.                }
  548.             }
  549.          }
  550.          return null;
  551.       }
  552.       
  553.       protected function getDestination(param1:String) : DressupResultPart
  554.       {
  555.          switch(param1.toLowerCase())
  556.          {
  557.             case "top":
  558.             case "dress":
  559.                return _mcTop;
  560.             case "bottom":
  561.                return _mcBottom;
  562.             case "shoe":
  563.                return _mcShoe;
  564.             case "accessory":
  565.                return null;
  566.             case "boyfriend":
  567.                return _mcAccessory;
  568.             default:
  569.                return _mcAccessory;
  570.          }
  571.       }
  572.       
  573.       override public function onUnfocus() : void
  574.       {
  575.          var _loc1_:SoundChannel = null;
  576.          super.onUnfocus();
  577.          for each(_loc1_ in _aVoiceOvers)
  578.          {
  579.             if(_loc1_ != null)
  580.             {
  581.                _loc1_.stop();
  582.             }
  583.          }
  584.          _aVoiceOvers = new Array();
  585.       }
  586.       
  587.       protected function enqueueRuleMatch(param1:Rule) : void
  588.       {
  589.          var rule:Rule = param1;
  590.          _aScoreEffects.push(function():*
  591.          {
  592.             var _loc1_:SoundChannel = null;
  593.             showCher();
  594.             _tfPlusRule.visible = true;
  595.             _tfPlusRule.text = "Style Bonus +" + rule.Score;
  596.             if(MainDocument.VOICE_OVERS_ENABLED)
  597.             {
  598.                if(!_bPartnerVO && !_bCherVOPositive)
  599.                {
  600.                   _loc1_ = SoundManager.getInstance().playSound(rule.Voice);
  601.                   _aVoiceOvers.push(_loc1_);
  602.                }
  603.             }
  604.             _tfCherChat.text = Localization.getString(rule.Comment);
  605.             Tweener.addTween(_tfPlusRule,{
  606.                "alpha":0,
  607.                "time":8 * _nTimeFactor
  608.             });
  609.             Tweener.addTween(_tfPlusRule,{
  610.                "y":_tfPlusRule.y - 300,
  611.                "time":16 * _nTimeFactor
  612.             });
  613.             _nDisplayedScore += rule.Score;
  614.          });
  615.          _bCherVOFashionRule = true;
  616.          _nFinalScore += rule.Score;
  617.       }
  618.       
  619.       protected function showPartner(param1:String) : void
  620.       {
  621.          var liketext:String = null;
  622.          var sc:SoundChannel = null;
  623.          var sText:String = param1;
  624.          SoundManager.getInstance().playSound("BoyfriendLovesOutfitSound");
  625.          _bBack.visible = false;
  626.          _tfBack.visible = false;
  627.          _tfBack.mouseEnabled = false;
  628.          _mcPartnerLayer.visible = true;
  629.          if(nCount > PARTNER_CUTSCENE_1)
  630.          {
  631.             _mcPartnerLayer.gotoAndStop(_dressupmodel.PartnerName + "_2");
  632.          }
  633.          else
  634.          {
  635.             _mcPartnerLayer.gotoAndStop(_dressupmodel.PartnerName);
  636.          }
  637.          _mcPartnerChat.visible = true;
  638.          _tfPartnerChat.visible = true;
  639.          _mcHeart0.visible = true;
  640.          _mcHeart1.visible = true;
  641.          _mcHeart2.visible = true;
  642.          Tweener.addTween(_mcHeart0,{
  643.             "x":_mcAffinityBar.x,
  644.             "time":1 * _nTimeFactor,
  645.             "transition":"easeoutcirc"
  646.          });
  647.          Tweener.addTween(_mcHeart0,{
  648.             "y":_mcAffinityBar.y,
  649.             "time":1 * _nTimeFactor,
  650.             "transition":"easeinoutsine"
  651.          });
  652.          Tweener.addTween(_mcHeart1,{
  653.             "x":_mcAffinityBar.x,
  654.             "time":1.5 * _nTimeFactor,
  655.             "transition":"easeoutCubic"
  656.          });
  657.          Tweener.addTween(_mcHeart1,{
  658.             "y":_mcAffinityBar.y,
  659.             "time":1.5 * _nTimeFactor,
  660.             "transition":"easeOutExpo"
  661.          });
  662.          Tweener.addTween(_mcHeart2,{
  663.             "x":_mcAffinityBar.x,
  664.             "time":2 * _nTimeFactor,
  665.             "transition":"easeoutquart"
  666.          });
  667.          Tweener.addTween(_mcHeart2,{
  668.             "y":_mcAffinityBar.y,
  669.             "time":2 * _nTimeFactor,
  670.             "transition":"easeOutCubic"
  671.          });
  672.          Tweener.addTween(_mcHeart2,{
  673.             "alpha":0,
  674.             "time":2.5 * _nTimeFactor,
  675.             "transition":"easeinquart"
  676.          });
  677.          Tweener.addTween(_mcHeart1,{
  678.             "alpha":0,
  679.             "time":2 * _nTimeFactor,
  680.             "transition":"easeinquart"
  681.          });
  682.          Tweener.addTween(_mcHeart0,{
  683.             "alpha":0,
  684.             "time":1.5 * _nTimeFactor,
  685.             "transition":"easeinquart",
  686.             "onComplete":function():*
  687.             {
  688.                var _loc1_:* = undefined;
  689.                var _loc2_:* = undefined;
  690.                var _loc3_:* = undefined;
  691.                var _loc4_:* = undefined;
  692.                var _loc5_:* = undefined;
  693.                var _loc6_:* = undefined;
  694.                var _loc7_:* = undefined;
  695.                var _loc8_:* = undefined;
  696.                _loc1_ = _dressupmodel.getPart("body").Template.Name;
  697.                _loc2_ = _dressupmodel.PartnerName;
  698.                _loc3_ = Profile.CurrentProfile.Affinities.getPairCounter(_loc1_,_loc2_);
  699.                _loc4_ = (_loc3_ as Number) / (PARTNER_CUTSCENE_2 as Number);
  700.                _mcAffinityBar.setRatio(_loc4_);
  701.                _loc5_ = _mcAffinityBar.x;
  702.                _loc6_ = _mcAffinityBar.y;
  703.                _loc7_ = _mcAffinityBar.scaleX;
  704.                _loc8_ = _mcAffinityBar.scaleY;
  705.                Tweener.removeTweens(_mcAffinityBar);
  706.                _mcAffinityBar.scaleX = _loc7_ * 1.1;
  707.                _mcAffinityBar.scaleY = _loc8_ * 1.1;
  708.                _mcAffinityBar.x -= _mcAffinityBar.width / 8;
  709.                _mcAffinityBar.y -= _mcAffinityBar.height / 8;
  710.                Tweener.addTween(_mcAffinityBar,{
  711.                   "scaleX":_loc7_,
  712.                   "scaleY":_loc8_,
  713.                   "x":_loc5_,
  714.                   "y":_loc6_,
  715.                   "time":1 * _nTimeFactor
  716.                });
  717.             }
  718.          });
  719.          if(sText != null)
  720.          {
  721.             _tfPartnerChat.text = Localization.getString(sText);
  722.          }
  723.          else
  724.          {
  725.             liketext = Database.getInstance().getPartner(_dressupmodel.PartnerName).getLikeText();
  726.             _tfPartnerChat.text = Localization.getString(liketext);
  727.             if(MainDocument.VOICE_OVERS_ENABLED)
  728.             {
  729.                sc = SoundManager.getInstance().playSound(liketext);
  730.                _aVoiceOvers.push(sc);
  731.                if((Profile.CurrentProfile.TutorialMask & Profile.kTutorial_BoyfriendPopup) == 0 && !bTutorialCher)
  732.                {
  733.                   setTutorial(new MCTutorialBoyfriendPopup());
  734.                   Profile.CurrentProfile.TutorialMask |= Profile.kTutorial_BoyfriendPopup;
  735.                }
  736.             }
  737.             switch(Profile.CurrentProfile.incrementImpress())
  738.             {
  739.                case 1:
  740.                   AchievementsList.showAchievement("head turner");
  741.                   Storage.getInstance().saveProfiles();
  742.                   break;
  743.                case 20:
  744.                   AchievementsList.showAchievement("total betty");
  745.                   Storage.getInstance().saveProfiles();
  746.                   break;
  747.                case 50:
  748.                   AchievementsList.showAchievement("major hottie");
  749.                   Storage.getInstance().saveProfiles();
  750.             }
  751.          }
  752.       }
  753.       
  754.       public function init(param1:DressupLevelInfo, param2:DressupModel, param3:DressupTheme) : void
  755.       {
  756.          var sCategory:String = null;
  757.          var part:Part = null;
  758.          var bGoodMatch:Boolean = false;
  759.          var bPartnerAttributesExist:Boolean = false;
  760.          var aPartnerAttributes:Array = null;
  761.          var sPartnerAttribute:String = null;
  762.          var aAttributeList:Array = null;
  763.          var sModel:String = null;
  764.          var sPartner:String = null;
  765.          var iMatches:int = 0;
  766.          var nRatio:Number = NaN;
  767.          var nPartScore:Number = NaN;
  768.          var i:int = 0;
  769.          var scoreeffect:ScoreEffect = null;
  770.          var pStartPoint:Point = null;
  771.          var pEndPoint:Point = null;
  772.          var nEndAlpha:Number = NaN;
  773.          var dressupresultpart:DressupResultPart = null;
  774.          var triple:Triple = null;
  775.          var rule:Rule = null;
  776.          var bMatch:Boolean = false;
  777.          var triple2:Triple = null;
  778.          var sAttribute:String = null;
  779.          var sType:String = null;
  780.          var sPose:String = null;
  781.          var nAdditionalMultiplier:Number = NaN;
  782.          var dli:DressupLevelInfo = param1;
  783.          var dressupmodel:DressupModel = param2;
  784.          var dressuptheme:DressupTheme = param3;
  785.          _mcTop.init("TOPS & DRESSES","",false,"?");
  786.          _mcBottom.init("BOTTOMS","",false,"?");
  787.          _mcShoe.init("FOOTWEAR","",false,"?");
  788.          _mcAccessory.init(dressupmodel.PartnerName.toUpperCase(),"",false,"?");
  789.          _dressuplevelinfo = dli;
  790.          _dressupmodel = dressupmodel;
  791.          _dressuptheme = dressuptheme;
  792.          _mcAccessory._tfLetter.visible = false;
  793.          _mcAccessory._mcDressupResultPartOk.visible = false;
  794.          _mcAccessory._mcDressupResultPartWrong.visible = false;
  795.          _tfModelName.text = Database.getInstance().getPartner(dressupmodel.PartnerName).TargetName;
  796.          _tfTitle1.text = _dressuptheme.Description;
  797.          bTutorialCher = false;
  798.          _mcModel.clone(dressupmodel);
  799.          _mcBackground.addChild(new Bitmap(MainDocument.BackgroundPackage.getImage(dressupmodel.ModelTheme.Background)));
  800.          setBackButton(_bBack);
  801.          installMouseOverSound(_bBack);
  802.          hideExtras();
  803.          if(_dressuplevelinfo.LevelName != "Tutorial")
  804.          {
  805.             bTutorial = false;
  806.          }
  807.          else
  808.          {
  809.             bTutorial = true;
  810.          }
  811.          _mcThumbnail.gotoAndStop(dressupmodel.PartnerName);
  812.          _nFinalScore = 0;
  813.          _nDisplayedScore = 0;
  814.          _nFinalGrade = 0;
  815.          _timer = new Timer(TIMER_INTERVAL);
  816.          _timer.addEventListener(TimerEvent.TIMER,onTimer,false,0,true);
  817.          _nOriginalX = _tfPoints.x;
  818.          _nOriginalY = _tfPoints.y;
  819.          for each(sCategory in ["top","bottom","shoe","accessory","dress","body"])
  820.          {
  821.             part = dressupmodel.getPart(sCategory);
  822.             if(part != null)
  823.             {
  824.                dli.UsedItems.push(part.Template.Name);
  825.             }
  826.          }
  827.          if(!_dressupmodel.isDressed())
  828.          {
  829.             _tfRanOutOfTime.visible = true;
  830.             tweenBonus(_tfRanOutOfTime);
  831.          }
  832.          _aScoreEffects = new Array();
  833.          bGoodMatch = true;
  834.          for each(sCategory in ["top","bottom","shoe","accessory","dress","body"])
  835.          {
  836.             part = _mcModel.getPart(sCategory);
  837.             nPartScore = scorePart(part);
  838.             _nFinalScore += nPartScore;
  839.             if(sCategory == "top" || sCategory == "bottom" || sCategory == "shoe")
  840.             {
  841.                _nFinalGrade += ConvertPartScore(nPartScore);
  842.             }
  843.             if(nPartScore < PART_GOOD_MINIMUM_SCORE && (sCategory == "top" || sCategory == "bottom"))
  844.             {
  845.                bGoodMatch = false;
  846.             }
  847.             if(nPartScore == 0 && (sCategory == "top" || sCategory == "bottom" || sCategory == "shoe"))
  848.             {
  849.                _bCherVONegative = true;
  850.             }
  851.             if(nPartScore < PART_SHOE_GOOD_MINIMUM_SCORE && sCategory == "shoe")
  852.             {
  853.                bGoodMatch = false;
  854.             }
  855.          }
  856.          bPartnerAttributesExist = false;
  857.          aPartnerAttributes = Database.getInstance().getPartner(dressupmodel.PartnerName).likesList(dressupmodel);
  858.          aAttributeList = new Array();
  859.          for each(sPartnerAttribute in aPartnerAttributes)
  860.          {
  861.             aAttributeList.push(sPartnerAttribute);
  862.          }
  863.          for each(sCategory in ["top","bottom","shoe","accessory"])
  864.          {
  865.             part = _mcModel.getPart(sCategory);
  866.             if(part != null)
  867.             {
  868.                i = 0;
  869.                while(i < aAttributeList.length)
  870.                {
  871.                   if(aAttributeList[i] != null)
  872.                   {
  873.                      sPartnerAttribute = aAttributeList[i] as String;
  874.                      if(part.Template.hasAttribute(sPartnerAttribute))
  875.                      {
  876.                         scoreeffect = new ScoreEffect();
  877.                         pStartPoint = part.localToGlobal(new Point(part.width / 2,part.height / 2));
  878.                         nEndAlpha = 1;
  879.                         dressupresultpart = getDestination("boyfriend");
  880.                         if(dressupresultpart != null)
  881.                         {
  882.                            triple = dressupresultpart.getNextCoordinate();
  883.                            pEndPoint = new Point(triple.First as Number,triple.Second as Number);
  884.                            nEndAlpha = triple.Third as Number;
  885.                         }
  886.                         else
  887.                         {
  888.                            pEndPoint = new Point();
  889.                         }
  890.                         scoreeffect.init("ΓÖÑ " + Database.getInstance().translateAttrib(sPartnerAttribute),BOYFRIEND_ATTRIBUTE_BONUS,pStartPoint,pEndPoint,nEndAlpha,dressupresultpart.onFinishedScoreEffect);
  891.                         scoreeffect.setTimeRatio(3 * _nTimeFactor);
  892.                         _aScoreEffects.push(scoreeffect);
  893.                         _nFinalScore += BOYFRIEND_ATTRIBUTE_BONUS;
  894.                         aAttributeList[i] = null;
  895.                      }
  896.                   }
  897.                   i++;
  898.                }
  899.             }
  900.          }
  901.          if(bPartnerAttributesExist)
  902.          {
  903.          }
  904.          _aScoreEffects.push(function():*
  905.          {
  906.             onAttributeScoresDone();
  907.          });
  908.          if(_dressupmodel.ModelTimer.getRatio() > TIMER_HIGH_RATIO)
  909.          {
  910.             _aScoreEffects.push(function():*
  911.             {
  912.                _tfPlusTimer.text = "Time Bonus +" + TIMER_HIGH_BONUS;
  913.                tweenBonus(_tfPlusTimer);
  914.                return TIMER_HIGH_BONUS;
  915.             });
  916.             _nFinalScore += TIMER_HIGH_BONUS;
  917.          }
  918.          else if(_dressupmodel.ModelTimer.getRatio() > TIMER_MID_RATIO)
  919.          {
  920.             _aScoreEffects.push(function():*
  921.             {
  922.                _tfPlusTimer.text = "Time Bonus +" + TIMER_MID_BONUS;
  923.                tweenBonus(_tfPlusTimer);
  924.                return TIMER_MID_BONUS;
  925.             });
  926.             _nFinalScore += TIMER_MID_BONUS;
  927.          }
  928.          if(!bTutorial)
  929.          {
  930.             for each(rule in _dressuplevelinfo.Package.Rules)
  931.             {
  932.                bMatch = true;
  933.                for each(triple2 in rule.Attributes)
  934.                {
  935.                   sAttribute = triple2.First as String;
  936.                   sType = triple2.Second as String;
  937.                   if(sType == "")
  938.                   {
  939.                      if(!_dressupmodel.isAttributePresent(sAttribute))
  940.                      {
  941.                         bMatch = false;
  942.                         break;
  943.                      }
  944.                   }
  945.                   else if(!_dressupmodel.isAttributePresentInCategory(sAttribute,sType))
  946.                   {
  947.                      bMatch = false;
  948.                      break;
  949.                   }
  950.                }
  951.                if(bMatch)
  952.                {
  953.                   addScoreDelay();
  954.                   enqueueRuleMatch(rule);
  955.                   break;
  956.                }
  957.             }
  958.          }
  959.          sModel = _dressupmodel.getPart("body").Template.Name;
  960.          sPartner = _dressupmodel.PartnerName;
  961.          iMatches = Profile.CurrentProfile.Affinities.getPairCounter(sModel,sPartner);
  962.          nRatio = (iMatches as Number) / (PARTNER_CUTSCENE_2 as Number);
  963.          _mcAffinityBar.setRatio(nRatio);
  964.          if(aPartnerAttributes.length >= MIN_LIKE_COUNT && _dressupmodel.isDressed() && !bTutorial)
  965.          {
  966.             _aScoreEffects.push(function():*
  967.             {
  968.                _tfPerfectBonus.text = "Boyfriend Match +" + PARTNER_BONUS + "!";
  969.                tweenBonus(_tfPerfectBonus);
  970.                return PARTNER_BONUS;
  971.             });
  972.             _nFinalScore += PARTNER_BONUS;
  973.             Profile.CurrentProfile.Affinities.incrementPairCounter(sModel,sPartner);
  974.             nCount = Profile.CurrentProfile.Affinities.getPairCounter(sModel,sPartner);
  975.             if(nCount % PARTNER_CHAT_INTERVAL == 0)
  976.             {
  977.                if(nCount == PARTNER_CUTSCENE_2)
  978.                {
  979.                   _aScoreEffects.push(function():*
  980.                   {
  981.                      showBoyFriendCutscene();
  982.                   });
  983.                }
  984.                else if(nCount == PARTNER_CUTSCENE_1)
  985.                {
  986.                   _aScoreEffects.push(function():*
  987.                   {
  988.                      showBoyFriendPopup(sPartner);
  989.                   });
  990.                }
  991.                else
  992.                {
  993.                   addScoreDelay();
  994.                   _aScoreEffects.push(function():*
  995.                   {
  996.                      showPartner(null);
  997.                   });
  998.                   _bPartnerVO = true;
  999.                }
  1000.             }
  1001.             if(nCount == PARTNER_CUTSCENE_2)
  1002.             {
  1003.                AchievementsList.checkAffinities();
  1004.             }
  1005.             _aScoreEffects.push(function():*
  1006.             {
  1007.                AchievementsList.incrementPerfect(sPartner);
  1008.             });
  1009.          }
  1010.          if(bGoodMatch && !bTutorial)
  1011.          {
  1012.             trace("Good match for : " + _dressupmodel.ModelTheme.Title);
  1013.             _aScoreEffects.push(function():*
  1014.             {
  1015.                AchievementsList.incrementOccasionGood(_dressupmodel.ModelTheme.Title);
  1016.             });
  1017.          }
  1018.          if(_dressuplevelinfo.DoubleDamage && _dressuplevelinfo.DoubleDamageTarget.toLowerCase() == _dressupmodel.PartnerName.toLowerCase())
  1019.          {
  1020.             _aScoreEffects.push(function():*
  1021.             {
  1022.                tweenBonus(_bDoubleDamage);
  1023.                ++_nDisplayedScoreMultiplier;
  1024.                return "1";
  1025.             });
  1026.             ++_nFinalScoreMultiplier;
  1027.             _dressuplevelinfo.DoubleDamage = false;
  1028.          }
  1029.          if(_dressuplevelinfo.LevelPoses.length > 0)
  1030.          {
  1031.             sPose = _dressuplevelinfo.LevelPoses.pop() as String;
  1032.             if(_dressupmodel.getPose() == sPose && checkPoseOrder(_dressuplevelinfo.LevelPoses.length,_dressupmodel.name))
  1033.             {
  1034.                nAdditionalMultiplier = _dressuplevelinfo.LevelPoseMultiplier;
  1035.                switch(_dressuplevelinfo.LevelPoses.length)
  1036.                {
  1037.                   case 0:
  1038.                      _aScoreEffects.push(function():*
  1039.                      {
  1040.                         _tfPlusPose.text = "Pose Bonus +" + nAdditionalMultiplier * 100 + "%";
  1041.                         tweenBonus(_tfPlusPose);
  1042.                         SoundManager.getInstance().playSound("PoseMatchSound3");
  1043.                         return nAdditionalMultiplier.toString();
  1044.                      });
  1045.                      break;
  1046.                   case 1:
  1047.                      _aScoreEffects.push(function():*
  1048.                      {
  1049.                         _tfPlusPose.text = "Pose Bonus +" + nAdditionalMultiplier * 100 + "%";
  1050.                         tweenBonus(_tfPlusPose);
  1051.                         SoundManager.getInstance().playSound("PoseMatchSound2");
  1052.                         return nAdditionalMultiplier.toString();
  1053.                      });
  1054.                      break;
  1055.                   default:
  1056.                      _aScoreEffects.push(function():*
  1057.                      {
  1058.                         _tfPlusPose.text = "Pose Bonus +" + nAdditionalMultiplier * 100 + "%";
  1059.                         tweenBonus(_tfPlusPose);
  1060.                         SoundManager.getInstance().playSound("PoseMatchSound1");
  1061.                         return nAdditionalMultiplier.toString();
  1062.                      });
  1063.                }
  1064.                _nFinalScoreMultiplier += nAdditionalMultiplier;
  1065.                _dressuplevelinfo.LevelPoseMultiplier += 0.5;
  1066.             }
  1067.             else
  1068.             {
  1069.                _dressuplevelinfo.LevelPoses = new Array();
  1070.             }
  1071.          }
  1072.          showPowerup(null);
  1073.          _powerup = _dressuplevelinfo.awardPowerup(_nFinalScore * _nFinalScoreMultiplier);
  1074.          if(_powerup != null)
  1075.          {
  1076.             _aScoreEffects.push(function():*
  1077.             {
  1078.                showPowerup(_powerup);
  1079.             });
  1080.          }
  1081.          _aScoreEffects.push(function():*
  1082.          {
  1083.             var _loc1_:Number = NaN;
  1084.             var _loc2_:Number = NaN;
  1085.             var _loc3_:Number = NaN;
  1086.             var _loc4_:Number = NaN;
  1087.             _loc1_ = _bBack.scaleX;
  1088.             _loc2_ = _bBack.scaleY;
  1089.             _loc3_ = _tfBack.scaleX;
  1090.             _loc4_ = _tfBack.scaleY;
  1091.             _bBack.scaleX = _loc1_ * 2;
  1092.             _bBack.scaleY = _loc2_ * 2;
  1093.             _tfBack.scaleX = _loc3_ * 2;
  1094.             _tfBack.scaleY = _loc4_ * 2;
  1095.             Tweener.addTween(_bBack,{
  1096.                "scaleX":_loc1_,
  1097.                "scaleY":_loc2_,
  1098.                "time":0.5 * _nTimeFactor
  1099.             });
  1100.             Tweener.addTween(_tfBack,{
  1101.                "scaleX":_loc3_,
  1102.                "scaleY":_loc3_,
  1103.                "time":0.5 * _nTimeFactor
  1104.             });
  1105.          });
  1106.          _aScoreEffects.reverse();
  1107.          _timer.start();
  1108.          _dressuplevelinfo.CurrentScore += _nFinalScore * _nFinalScoreMultiplier;
  1109.          if(_dressupmodel.isDressed())
  1110.          {
  1111.             _dressuplevelinfo.TopModels[3].dressupmodel.clone(_dressupmodel);
  1112.             _dressuplevelinfo.TopModels[3].Score = _nFinalScore * _nFinalScoreMultiplier;
  1113.             _dressuplevelinfo.TopModels.sortOn("Score",[Array.DESCENDING | Array.NUMERIC]);
  1114.          }
  1115.       }
  1116.       
  1117.       protected function checkPoseOrder(param1:int, param2:*) : Boolean
  1118.       {
  1119.          if(2 == param1 && "_model1" == param2 || 1 == param1 && "_model0" == param2 || 0 == param1 && "_model2" == param2)
  1120.          {
  1121.             return true;
  1122.          }
  1123.          return false;
  1124.       }
  1125.       
  1126.       public function hidePartner() : void
  1127.       {
  1128.          _mcPartnerLayer.visible = false;
  1129.       }
  1130.       
  1131.       protected function updateScore(param1:Number) : void
  1132.       {
  1133.          var _loc2_:TextField = null;
  1134.          _tfPoints.text = param1.toString();
  1135.          Tweener.removeTweens(_tfPoints);
  1136.          _tfPoints.scaleX = 2;
  1137.          _tfPoints.scaleY = 2;
  1138.          _tfPoints.x -= _tfPoints.width * 3 / 8;
  1139.          _tfPoints.y -= _tfPoints.height / 5;
  1140.          Tweener.addTween(_tfPoints,{
  1141.             "scaleX":1,
  1142.             "scaleY":1,
  1143.             "x":_nOriginalX,
  1144.             "y":_nOriginalY,
  1145.             "time":0.5 * _nTimeFactor
  1146.          });
  1147.       }
  1148.       
  1149.       protected function onClearPartner(param1:MouseEvent) : void
  1150.       {
  1151.          this.removeEventListener(MouseEvent.CLICK,onClearPartner,true);
  1152.          _mcPartnerChat.visible = false;
  1153.          _tfPartnerChat.visible = false;
  1154.          Tweener.addTween(_mcPartnerLayer,{
  1155.             "alpha":0,
  1156.             "time":0.3 * _nTimeFactor,
  1157.             "transition":"linear",
  1158.             "onComplete":hidePartner
  1159.          });
  1160.          param1.stopImmediatePropagation();
  1161.          if(_emitter != null)
  1162.          {
  1163.             _emitter.pause();
  1164.          }
  1165.          _bBack.visible = true;
  1166.          _tfBack.visible = true;
  1167.          _tfBack.mouseEnabled = false;
  1168.       }
  1169.       
  1170.       protected function showBlast(param1:Number, param2:Number) : void
  1171.       {
  1172.          var _loc3_:DisplayObjectRenderer = null;
  1173.          _emitter = new Emitter();
  1174.          _emitter.counter = new Blast(50);
  1175.          _emitter.addInitializer(new ImageClasses([KintabLarge,KintabSmall]));
  1176.          _emitter.addInitializer(new Position(new PointZone(new Point(param1,param2))));
  1177.          _emitter.addInitializer(new Lifetime(6,9));
  1178.          _emitter.addAction(new Age());
  1179.          _emitter.addAction(new Fade());
  1180.          _emitter.addInitializer(new Velocity(new RectangleZone(-50,-100,50,50)));
  1181.          _emitter.addAction(new Move());
  1182.          _emitter.addAction(new Accelerate(0,50));
  1183.          _loc3_ = new DisplayObjectRenderer();
  1184.          _emitter.renderer = _loc3_;
  1185.          addChild(_loc3_);
  1186.          _emitter.start();
  1187.          _emitter.runAhead(3);
  1188.          trace("Started effect at :" + param1 + "," + param2);
  1189.       }
  1190.       
  1191.       protected function onSkipTutorial(param1:MouseEvent) : void
  1192.       {
  1193.          Profile.CurrentProfile.SkipTutorial = true;
  1194.          onBack(new MouseEvent(""));
  1195.       }
  1196.       
  1197.       protected function addScoreDelay() : void
  1198.       {
  1199.          _aScoreEffects.push(function():*
  1200.          {
  1201.             _iEffectDelay = _iScoringSpeed;
  1202.          });
  1203.       }
  1204.       
  1205.       public function showBoyFriendPopup(param1:String) : *
  1206.       {
  1207.          var _loc2_:String = null;
  1208.          var _loc3_:String = null;
  1209.          var _loc4_:int = 0;
  1210.          var _loc5_:Number = NaN;
  1211.          var _loc6_:BoyfriendsPopupForm = null;
  1212.          _loc2_ = _dressupmodel.getPart("body").Template.Name;
  1213.          _loc3_ = _dressupmodel.PartnerName;
  1214.          _loc5_ = ((_loc4_ = Profile.CurrentProfile.Affinities.getPairCounter(_loc2_,_loc3_)) as Number) / (PARTNER_CUTSCENE_2 as Number);
  1215.          _mcAffinityBar.setRatio(_loc5_);
  1216.          SoundManager.getInstance().playSound("BoyfriendLovesOutfitSound");
  1217.          (_loc6_ = new BoyfriendsPopupForm()).init(param1);
  1218.          BaseForm.setForm(_loc6_,true);
  1219.       }
  1220.       
  1221.       public function showBoyFriendCutscene() : *
  1222.       {
  1223.          var _loc1_:BFCutsceneForm = null;
  1224.          _mcAffinityBar.setRatio(1);
  1225.          SoundManager.getInstance().playSound("BoyfriendLovesOutfitSound");
  1226.          _loc1_ = new BFCutsceneForm();
  1227.          _loc1_.init(_dressupmodel);
  1228.          BaseForm.setForm(_loc1_,true);
  1229.       }
  1230.       
  1231.       protected function scorePart(param1:Part) : Number
  1232.       {
  1233.          var _loc2_:Number = NaN;
  1234.          var _loc3_:Array = null;
  1235.          var _loc4_:String = null;
  1236.          var _loc5_:PartAttribute = null;
  1237.          var _loc6_:ScoreEffect = null;
  1238.          var _loc7_:Point = null;
  1239.          var _loc8_:Point = null;
  1240.          var _loc9_:Number = NaN;
  1241.          var _loc10_:DressupResultPart = null;
  1242.          var _loc11_:Triple = null;
  1243.          _loc2_ = 0;
  1244.          _loc3_ = new Array();
  1245.          if(param1 != null)
  1246.          {
  1247.             for each(_loc4_ in _dressuptheme.TargetAttributes)
  1248.             {
  1249.                if(_dressuptheme.Title.toLowerCase().indexOf(_loc4_.toLowerCase()) < 0)
  1250.                {
  1251.                   if(param1.Template.hasAttribute(_loc4_))
  1252.                   {
  1253.                      _loc3_.push(param1.Template.getAttribute(_loc4_));
  1254.                   }
  1255.                }
  1256.             }
  1257.             for each(_loc5_ in _loc3_)
  1258.             {
  1259.                _loc6_ = new ScoreEffect();
  1260.                _loc7_ = param1.localToGlobal(new Point(param1.width / 2,param1.height / 2));
  1261.                _loc9_ = 1;
  1262.                if((_loc10_ = getDestination(param1.Template.Category)) != null)
  1263.                {
  1264.                   _loc11_ = _loc10_.getNextCoordinate();
  1265.                   _loc8_ = new Point(_loc11_.First as Number,_loc11_.Second as Number);
  1266.                   _loc9_ = _loc11_.Third as Number;
  1267.                   _loc6_.init(_loc5_.Name,_loc5_.Score,_loc7_,_loc8_,_loc9_,_loc10_.onFinishedScoreEffect);
  1268.                   _loc6_.setTimeRatio(_nTimeFactor);
  1269.                }
  1270.                else
  1271.                {
  1272.                   _loc8_ = new Point(_loc7_.x,_loc7_.y - 100);
  1273.                   _loc6_.init(_loc5_.Name + (_loc5_.Score > 0 ? " +" : " -") + _loc5_.Score,_loc5_.Score,_loc7_,_loc8_,0,null);
  1274.                   _loc6_.setTimeRatio(10 * _nTimeFactor);
  1275.                }
  1276.                _aScoreEffects.push(_loc6_);
  1277.                _loc2_ += _loc5_.Score;
  1278.             }
  1279.          }
  1280.          return _loc2_;
  1281.       }
  1282.       
  1283.       protected function convertGrade(param1:String) : int
  1284.       {
  1285.          var _loc2_:int = 0;
  1286.          switch(param1)
  1287.          {
  1288.             case "A":
  1289.                _loc2_ = 95;
  1290.                break;
  1291.             case "B":
  1292.                _loc2_ = 85;
  1293.                break;
  1294.             case "C":
  1295.                _loc2_ = 75;
  1296.                break;
  1297.             case "D":
  1298.                _loc2_ = 65;
  1299.                break;
  1300.             default:
  1301.                _loc2_ = 55;
  1302.          }
  1303.          return _loc2_;
  1304.       }
  1305.    }
  1306. }
  1307.